package com.tedu.mybatis.mapper;

import com.tedu.mybatis.pojo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiBoMapper {
//@Insert("INSERT INTO weibo(content,user_id)VALUES (#{content},#{userId})")
    int insertWeiBo(WeiBo weibo);

    //@Delete("DELETE FROM weibo WHERE id = #{id}")
    int deleteWeiBo(WeiBo weibo);
    //@Select("SELECT id,content,created,user_id userId FROM weibo")
    List<WeiBo> selectAllWeiBo();

    //@Select("SELECT id,content,created,user_id userId FROM weibo WHERE id = #{id}")
    WeiBo selectSingleWeiBo(Integer id);
    //@Update("UPDATE weibo SET content = #{content},created = #{created},user_id = #{userId} WHERE id = #{id}")
    int updateWeiBo(WeiBo weibo);

    //@Select("SELECT content,created FROM weibo WHERE id = #{id}")
    WeiboVO1 selectSingleWeiboVO1(Integer id);

    //@Select("SELECT content,user_id userId FROM weibo")
    List<WeiboVO2> selectAllWeiboVO2();

    int dynamicUpdateById(WeiBo weibo);
    int dynamicDeleteById(Integer[] id);
    int dynamicDeleteById2(List<Integer> id);
    WeiboVO3 selectResultMap(Integer id);

    UserVO1 selectUserAndWeiboById(Integer id);

    WeiboVO4 selectWeiboAndCommentById(Integer id);

    int countWeibo();
}
